package LeetCode;

/**
 * @author VX5
 * @Title: MJC
 * @ProjectName DataStructure
 * @Description: TODO
 * @date ${DAT}18:34
 */
public class E2 {//贪心算法 找出做大的数集合
    public static void main(String[] args) {
        int[] arr = {1, 100, 1, 1, 1, 100, 1, 1, 100, 1};
        down(arr);
    }
    public static void down(int[] cost){
        int dp[] = new int[cost.length+1];
        dp[0] = cost[0];
        dp[1] = cost[1];
        for (int i = 2; i <= cost.length; i++){
            if (i != cost.length)
                dp[i] = cost[i];
            else
                dp[i] = 0;
            dp[i]+=Math.min(dp[i-2],dp[i-1]);
        }

        System.out.println(dp[cost.length]);

    }
}
